package mysql

import (
	"fmt"
	"good/appconfig"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

var (
	db  *gorm.DB
	err error
)

func MysqlConn() {
	dsn := appconfig.Init.MysqlConfig.Dsn
	db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
	if err != nil {
		fmt.Println("viper获取失败")
	}
	db.AutoMigrate(new(Good))
}
